#include "myThreadPool.h"
#include <iostream>
#include <chrono>
#include <thread>

//输出线程ID和当前时间
void testTask() 
{
    std::cout << "Task executed by thread " << std::this_thread::get_id() << " at "
              << std::chrono::system_clock::now().time_since_epoch().count() << std::endl;
}

int main() {
    // 创建线程池，最小线程数为2，最大线程数为4，队列大小为10
    ThreadPool pool(2, 4, 10);

    for (int i = 0; i < 10; ++i) {
        pool.addTask(testTask);
    }

    // 休眠一段时间
    std::this_thread::sleep_for(std::chrono::seconds(3));
    pool.stop();
    return 0;
}